<script type="text/javascript">

    $(function(){
        $(".test").bind('click',function(){
            $('#exampleModal').arcticmodal({
                beforeClose: function(data, el) {
                    $(this).value = 'ok';
                }
            });
            $('#b-modal-ready').live('click', function(){
                $('#exampleModal').arcticmodal('close');
            });
        });
    });

    function setVal(val){
        $('#b-modal-ready').val(val);
    }

    </script>
<input type="button" class="test" name="test" value="test" onclick="setVal('156')">
<div>
    <input type="hidden" value="156">
    <input type="hidden" value="154">
</div>